package main

import "fmt"

// 简单的结构体构造
type person struct {
	name, city string
	age        int
}

// 构造结构体实例
// 结构体是值类型的，所以为了节省内存，使用 内存
func newPerson(name, city string, age int) person {
	return person{
		name: name,
		city: city,
		age:  age,
	}
}

func newPerson1(name, city string, age int) *person {
	return &person{
		name: name,
		city: city,
		age:  age,
	}
}

func main() {
	p1 := newPerson("sunshicheng", "beijing", 18)
	fmt.Printf("type is : %T ,value is : %#v \n", p1, p1)

	p2 := newPerson1("wubeinan", "haerbin", 19)
	fmt.Printf("type is : %T, value is : %#v\n", p2, p2)
}
